<!-- 屈光发育档案/检查信息管理(三维检查) -->
<template>
  <div>
    <el-form :model="dataForm" ref="dataForm" size="medium" label-width="100px" v-loading.fullscreen.lock="fullscreenLoading" :disabled="formType == 'check'">
      <el-divider content-position="center" style="margin-top: 0;">基础信息</el-divider>
      <el-row :gutter="10">
        <el-col :span="6">
          <el-form-item label="标识" prop="cardNum">
            <el-input v-model="personInfo.cardNum" placeholder="标识">
              <el-button slot="append" @click="readCard(personInfo.cardNum)">读卡</el-button>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="姓名" prop="name">
            <el-input v-model="personInfo.name" placeholder="姓名" readonly>
              <el-button slot="append" @click="openDialog('person')">查询</el-button>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="出生年月" prop="birthDay">
            <el-input v-model="personInfo.birthDay" placeholder="出生年月" disabled></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="民族" prop="nation">
            <el-select v-model="personInfo.nation" readonly>
              <el-option v-for="item in nationalList" :value="item.id" :label="item.name" :key="item.id"></el-option>
            </el-select>
            <!-- <el-input v-model="personInfo.nation" disabled></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="10">
        <el-col :span="6">
          <el-form-item label="唯一标识" prop="uniqueCode">
            <el-input v-model="personInfo.uniqueCode" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="性别" prop="gender">
						<el-input v-if="personInfo.gender == '0'" value="男" readonly></el-input>
            <el-input v-if="personInfo.gender == '1'" value="女" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="联系电话" prop="telPhone">
            <el-input v-model="personInfo.telPhone" placeholder="联系电话" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="家庭住址" prop="address">
            <el-input v-model="personInfo.address" placeholder="家庭住址" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="戴镜类型" prop="wearType">
            <el-select v-model="personInfo.personExtProp.wearType">
              <el-option :value="1" label="框架眼镜"></el-option>
              <el-option :value="2" label="软性隐形眼镜"></el-option>
              <el-option :value="3" label="角膜塑形镜"></el-option>
              <el-option :value="4" label="不戴镜"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="出生体重" prop="birthWeight">
            <el-input v-model="personInfo.personExtProp.birthWeight" placeholder="出生体重">
              <template slot="append">g</template>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="是否早产" prop="premature">
            <el-select v-model="personInfo.personExtProp.premature" style="width: 100px">
              <el-option :value="0" label="否"></el-option>
              <el-option :value="1" label="是"></el-option>
            </el-select>
            <el-input v-model="personInfo.personExtProp.preWeek" placeholder="早产周数" style="width: 120px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="父亲近视史" prop="fatherMyopia">
            <el-select v-model="personInfo.personExtProp.fatherMyopia">
              <el-option value="0" label="无"></el-option>
              <el-option value="1" label="轻度"></el-option>
              <el-option value="2" label="中度"></el-option>
              <el-option value="3" label="重度"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="母亲近视史" prop="motherMyopia">
            <el-select v-model="personInfo.personExtProp.motherMyopia">
              <el-option value="0" label="无"></el-option>
              <el-option value="1" label="轻度"></el-option>
              <el-option value="2" label="中度"></el-option>
              <el-option value="3" label="重度"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="开始使用铅笔学习书写的年龄" prop="writeAge" label-width="200px">
            <el-input v-model="personInfo.personExtProp.writeAge">
              <template slot="append">岁</template>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="习惯用手" prop="habitHand">
            <el-radio-group v-model="personInfo.personExtProp.habitHand">
              <el-radio label="Y">右手</el-radio>
              <el-radio label="Z">左手</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>

      </el-row>
      <el-divider content-position="center">检查结果</el-divider>
      <el-row :gutter="10">
        <el-col :span="6">
          <el-form-item label="学校类型">
            <el-select v-model="dataForm.optometry.schoolType" @change="schoolTypeChange" clearable>
              <el-option v-for="item in schoolTypeOption" :value="item.value" :label="item.label" :key="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item label="学校" prop="optometry.schoolId">
            <el-select v-model="dataForm.optometry.schoolId" clearable filterable default-first-option style="min-width: 360px;" @change="schoolChange($event,'','')">
              <el-option v-for="item in schoolOption" :value="item.id" :label="'('+ item.pinyinCode + ')' + item.schoolName" :key="item.id"></el-option>
            </el-select>
            <el-select v-model="dataForm.optometry.gradeId" filterable clearable @change="getClassOption($event,'')">
              <el-option v-for="item in gradeOption" :value="item.id" :label="item.gradeName" :key="item.id"></el-option>
            </el-select>
            <el-select v-model="dataForm.optometry.classId" filterable default-first-option clearable>
              <el-option v-for="item in classOptions" :value="item.id" :label="item.className" :key="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="10">
        <el-col :span="6">
          <el-form-item label="检查时间" prop="optometry.checkDate">
            <el-date-picker v-model="dataForm.optometry.checkDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" @change="checkChangeHandle"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="体重" prop="optometry.weight">
            <div class="el-input el-input--medium el-input-group el-input-group--append">
              <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.weight">
              <div class="el-input-group__append">KG</div>
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="身高" prop="optometry.height">
            <div class="el-input el-input--medium el-input-group el-input-group--append">
              <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.height" @keydown.tab.prevent="tabKayChangeHandle('start')">
              <div class="el-input-group__append">CM</div>
            </div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <table class="miui-table">
          <tr>
            <td width="50px" class="label-bg"></td>
            <td class="label-bg">裸眼远视力</td>
            <td colspan="3" class="label-bg">旧镜度数</td>
            <td class="label-bg">生活远视力</td>
            <td colspan="3" class="label-bg">动态屈光检测</td>
            <td class="label-bg">眼前段及眼附属器</td>
            <td class="label-bg">眼轴长度</td>
          </tr>
          <tr>
            <td class="label-bg">右眼</td>
            <td>
              <el-form-item prop="optometry.nakedOd" label-width="0px">
              <div class="el-input el-input--medium">
                <input type="text" class="el-input__inner" ref="start" v-model.lazy="dataForm.optometry.nakedOd" tabindex="35">
              </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.oldBallGlassOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldBallGlassOd" placeholder="球镜" tabindex="37">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.oldPostGlassOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldPostGlassOd" placeholder="柱镜" tabindex="38">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.oldAxesOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldAxesOd" placeholder="轴向" tabindex="39">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.distantOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.distantOd" tabindex="43">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.ballGlassOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.ballGlassOd" placeholder="球镜" tabindex="45">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.postGlassOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.postGlassOd" placeholder="柱镜" tabindex="46">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.axesOd" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.axesOd" placeholder="轴向" tabindex="47">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-radio-group v-model="dataForm.optometry.frontOd">
                <el-radio :label="0" tabindex="51">正常</el-radio>
                <el-radio :label="1" tabindex="51">异常</el-radio>
              </el-radio-group>
              <div class="el-input el-input--medium" style="min-width: 120px;">
                <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.frontOdText" tabindex="52">
              </div>
            </td>
            <td>
              <el-form-item prop="optometry.axialLengthOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.axialLengthOd" tabindex="55">
                </div>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td class="label-bg">左眼</td>
            <td>
              <el-form-item prop="optometry.nakedOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.nakedOs" tabindex="36">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.oldBallGlassOs" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldBallGlassOs" placeholder="球镜" tabindex="40">
                </div>
              </el-form-item>

            </td>
            <td>
              <el-form-item prop="optometry.oldPostGlassOs" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldPostGlassOs" placeholder="柱镜" tabindex="41">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.oldAxesOs" label-width="0px">

                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.oldAxesOs" placeholder="轴向" tabindex="42">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.distantOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.distantOs" tabindex="44">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.ballGlassOs" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.ballGlassOs" placeholder="球镜" tabindex="48">
                </div>
              </el-form-item>

            </td>
            <td>
              <el-form-item prop="optometry.postGlassOs" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.postGlassOs" placeholder="柱镜" tabindex="49">
                </div>
              </el-form-item>

            </td>
            <td>
              <el-form-item prop="optometry.axesOs" label-width="0px">
                <div class="el-input el-input--medium" style="min-width: 60px;">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.axesOs" placeholder="轴向" tabindex="50">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-radio-group v-model="dataForm.optometry.frontOs">
                <el-radio :label="0" tabindex="53">正常</el-radio>
                <el-radio :label="1" tabindex="53">异常</el-radio>
              </el-radio-group>
              <div class="el-input el-input--medium" style="min-width: 120px;">
                <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.frontOsText" tabindex="54">
              </div>
            </td>
            <td>
              <el-form-item prop="optometry.axialLengthOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.axialLengthOs" tabindex="56">
                </div>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-row>
      <el-row>
        <table class="miui-table">
          <tr>
            <td width="50px" class="label-bg"></td>
            <td class="label-bg">角膜厚度mm</td>
            <td class="label-bg">前房深度mm</td>
            <td colspan="2" class="label-bg">角膜曲率K1(D)</td>
            <td colspan="2" class="label-bg">角膜曲率K2(D)</td>
            <td class="label-bg">角膜直径mm</td>
            <td class="label-bg">眼压mmHg</td>
          </tr>
          <tr>
            <td class="label-bg">右眼</td>
            <td>
              <el-form-item prop="optometry.depthOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.depthOd" tabindex="57">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.adOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.adOd" tabindex="59">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK1Od" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK1Od" tabindex="61">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK1OdInfo" label-width="0px">
                <div class="el-input el-input--medium el-input-group el-input-group--prepend">
                  <div class="el-input-group__prepend">@</div>
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK1OdInfo" tabindex="62">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK2Od" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK2Od" tabindex="65">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK2OdInfo" label-width="0px">
                <div class="el-input el-input--medium el-input-group el-input-group--prepend">
                  <div class="el-input-group__prepend">@</div>
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK2OdInfo" tabindex="66">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.wtwOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.wtwOd" tabindex="69">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.iopOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.iopOd" tabindex="71">
                </div>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td class="label-bg">左眼</td>
            <td>
              <el-form-item prop="optometry.depthOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.depthOs" tabindex="58">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.adOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.adOs" tabindex="60">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK1Os" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK1Os" tabindex="63">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK1OsInfo" label-width="0px">
                <div class="el-input el-input--medium el-input-group el-input-group--prepend">
                  <div class="el-input-group__prepend">@</div>
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK1OsInfo" tabindex="64">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK2Os" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK2Os" tabindex="67">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.curvatureK2OsInfo" label-width="0px">
                <div class="el-input el-input--medium el-input-group el-input-group--prepend">
                  <div class="el-input-group__prepend">@</div>
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.curvatureK2OsInfo" tabindex="68">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.wtwOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.wtwOs" tabindex="70">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.iopOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.iopOs" tabindex="72">
                </div>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-row>
      <el-row>
        <table class="miui-table">
          <tr>
            <td width="50px" class="label-bg"></td>
            <td colspan="2" class="label-bg">眼底检查</td>
            <td colspan="3" class="label-bg">散瞳验光(<el-button type="text" @click="breakCheckHandle">动态屈光</el-button>)</td>
            <td class="label-bg">矫正视力</td>
            <td colspan="3" class="label-bg">主觉验光(<el-button type="text" @click="mainCheckHandle">散瞳验光</el-button>)</td>
            <td class="label-bg">矫正视力</td>
          </tr>
          <tr>
            <td class="label-bg">右眼</td>
            <td>
              <el-select v-model="dataForm.optometry.fundusExaminationOd" tabindex="73">
                <el-option v-for="item in fundusExaminationOption" :value="item.value" :label="item.label" :key="item.value"></el-option>
              </el-select>
            </td>
            <td>
              <div class="el-input el-input--medium">
                <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.fundusExaminationInfoOd" tabindex="74">
              </div>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptBallOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptBallOd" placeholder="球镜" tabindex="77">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptPostOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptPostOd" placeholder="柱镜" tabindex="78">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptAxesOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptAxesOd" placeholder="轴向" tabindex="79">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptCvaOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptCvaOd" tabindex="80">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptBallOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptBallOd" placeholder="球镜" tabindex="85">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptPostOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptPostOd" placeholder="柱镜" tabindex="86">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptAxesOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptAxesOd" placeholder="轴向" tabindex="87">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptCvaOd" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptCvaOd" tabindex="88">
                </div>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td class="label-bg">左眼</td>
            <td>
              <el-select v-model="dataForm.optometry.fundusExaminationOs" tabindex="75">
                <el-option v-for="item in fundusExaminationOption" :value="item.value" :label="item.label" :key="item.value"></el-option>
              </el-select>
            </td>
            <td>
              <el-form-item prop="optometry.fundusExaminationInfoOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.fundusExaminationInfoOs" tabindex="76">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptBallOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptBallOs" placeholder="球镜" tabindex="81">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptPostOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptPostOs" placeholder="柱镜" tabindex="82">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptAxesOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptAxesOs" placeholder="轴向" tabindex="83">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mydriaticOptCvaOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mydriaticOptCvaOs" tabindex="84">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptBallOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptBallOs" placeholder="球镜" tabindex="89">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptPostOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptPostOs" placeholder="柱镜" tabindex="90">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptAxesOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptAxesOs" placeholder="轴向" tabindex="90" @keydown.tab.prevent="tabKayChangeHandle('end')">
                </div>
              </el-form-item>
            </td>
            <td>
              <el-form-item prop="optometry.mainOptCvaOs" label-width="0px">
                <div class="el-input el-input--medium">
                  <input type="text" class="el-input__inner" v-model.lazy="dataForm.optometry.mainOptCvaOs" ref="end">
                </div>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-row>
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="眼位">
            <el-radio-group v-model="dataForm.optometry.eyePosition">
              <el-radio :label="0">正位</el-radio>
              <el-radio :label="1">隐斜</el-radio>
              <el-radio :label="2">显斜</el-radio>
            </el-radio-group>
            <el-select v-if="dataForm.optometry.eyePosition == 1" v-model="dataForm.optometry.eyePositionCrypticInfo" style="width: 80px;margin-left: 15px;">
              <el-option value="1" label="内"></el-option>
              <el-option value="2" label="外"></el-option>
              <el-option value="3" label="上"></el-option>
              <el-option value="4" label="下"></el-option>
            </el-select>
            <el-select v-if="dataForm.optometry.eyePosition == 2" v-model="dataForm.optometry.eyePositionInfo" style="width: 80px;margin-left: 15px;">
              <el-option value="1" label="内"></el-option>
              <el-option value="2" label="外"></el-option>
              <el-option value="3" label="上"></el-option>
              <el-option value="4" label="下"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="握笔姿势" prop="optometry.pencilGrasps">
            <el-radio-group v-model="dataForm.optometry.pencilGrasps">
              <el-radio :label="0">正确</el-radio>
              <el-radio :label="1">错误</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="集合近点">
            <el-input style="width: 150px;" v-model="dataForm.optometry.nearPoint">
              <template slot="append">cm</template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="色觉">
            <el-radio-group v-model="dataForm.optometry.colorVision">
              <el-radio :label="0">正常</el-radio>
              <el-radio :label="1">色弱</el-radio>
              <el-radio :label="2">色盲</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="优势眼">
            <el-radio-group v-model="dataForm.optometry.masterEye">
              <el-radio :label="0">右眼</el-radio>
              <el-radio :label="1">左眼</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-divider content-position="center">初步诊断</el-divider>
      <el-row :gutter="10">
        <el-col :span="12">
          <el-form-item label="屈光状态">
            <el-select v-model="dataForm.optometry.refractiveStatus" clearable filterable default-first-option>
              <el-option v-for="item in refractiveOption" :value="item.value" :label="item.label" :key="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="近视预警"  prop="optometry.myopiaWarning">
            <el-radio-group v-model="dataForm.optometry.myopiaWarning">
              <el-radio label="R">红色</el-radio>
              <el-radio label="Y">黄色</el-radio>
              <el-radio label="B">蓝色</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="眼病">
            <el-input type="textarea" v-model="dataForm.optometry.eyeDisease"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="复查类型">
            <el-select v-model="dataForm.optometry.recheckType">
              <el-option :value="1" label="初次"></el-option>
              <el-option :value="2" label="一周"></el-option>
              <el-option :value="3" label="一月"></el-option>
              <el-option :value="4" label="三月"></el-option>
              <el-option :value="5" label="半年"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="预约复查时间" label-width="100px">
            <el-date-picker v-model="dataForm.optometry.nextCheckDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" :picker-options="pickerOptions"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="主检医生">
            <el-select v-model="dataForm.optometry.mainDoctor" clearable filterable default-first-option @change="changeMainDoctor">
              <el-option v-for="item in doctorOptions" :value="item.id" :label="item.realName" :key="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
				<el-col :span="6">
				  <el-form-item label="视光医生">
				    <el-select v-model="dataForm.optometry.checkDoctor" clearable filterable default-first-option @change="changeDoctor">
				      <el-option v-for="item in userOptions" :value="item.id" :label="item.realName" :key="item.id"></el-option>
				    </el-select>
				  </el-form-item>
				</el-col>
      </el-row>
    </el-form>
    <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span> -->
    <!-- 弹窗，选择人员 -->
    <search-person v-if="personVisible" ref="personDialog" @refreshForm="getPersonData"></search-person>
  </div>
</template>

<script>
  import { remote } from '@/api/admin/dict'
  import { getNowTime } from '@/api/base/base'
  import { getPvmArcOptometryObj, addPvmArcOptometryObj, putPvmArcOptometryObj, getCheckRecord } from '@/api/pvm/arcoptometry'
  import { getPersonObj, fetchPersonInfoByCode } from '@/api/pvm/person'

  import { getSchoolListBySchoolType, getSchoolList, getClassOptions } from '@/api/pvm/school'
  import { getGradeBySchoolId } from '@/api/pvm/grade'
  import { getUserListByMenu, getUserListByJobType } from '@/api/admin/user'
  import { fetchNationalList } from '@/api/admin/national'
  import { mapGetters } from 'vuex'

  import SearchPerson from '@/components/business/person-search'

  //验证数字和小数点
var checkNumber = (rule, value, callback) => {
    let weightReg = /^((\d*\.\d{0,2})|(\d*)|(-\d*)|(-\d*\.\d{0,2}))$/
    if(!weightReg.test(value)){
      callback(new Error('请输入数字类型,可包含两位小数参数'))
    } else {
      callback()
    }
  }

  var checkWeight = (rule, value, callback) => {
    if(value <8 || value>150){
      callback(new Error('体重最小值为8，最大值为150'))
    }else{
      callback()
    }
  }

  var checkHeight = (rule, value, callback) => {
    if(value <60 || value>250){
      callback(new Error('身高最小值为60，最大值为250'))
    }else{
      callback()
    }
  }

  export default {
    data() {
      return {
        visible: false,
        twoVisible: false,
        fullscreenLoading: false,
        weightType: false,
        formType: '',
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() <= Date.now();
          },
        },

        doctorOptions: [],
        nationalList: [],
        personInfo: {
          cardNumber: '',
          cardNum: '',
          checkUsername: '',
          birthDay: '',
          certificateNum: '',
          gender: '',
          telPhone: '',
          address: '',
          personExtProp: {
            fatherMyopia: '',
            motherMyopia: '',
            habitHand: '',
            birthWeight: '',
            premature: '',
            preWeek: '',
            wareType: '',
          },
        },
        dataForm: {
          id: 0,
          personInfo: {},
          optometry: {
            schoolId: '',
            schoolName: '',
            schoolType: '',
            gradeId: '',
            gradeName: '',
            classId: '',
            className: '',
            createTime: '',
            weight: '',
            height: '',
            nakedOd: '',
            nakedOs: '',
            oldBallGlassOd: '',
            oldPostGlassOd: '',
            oldAxesOd: '',
            oldBallGlassOs: '',
            oldPostGlassOs: '',
            oldAxesOs: '',
            distantOd: '',
            distantOs: '',
            ballGlassOd: '',
            postGlassOd: '',
            axesOd: '',
            ballGlassOs: '',
            postGlassOs: '',
            axesOs: '',
            frontOd: '',
            frontOs: '',
            frontOdText: '',
            frontOsText: '',
            axialLengthOd: '',
            axialLengthOs: '',
            depthOd: '',
            depthOs: '',
            adOd: '',
            adOs: '',
            curvatureK1Od: '',
            curvatureK1OdInfo: '',
            curvatureK1Os: '',
            curvatureK1OsInfo: '',
            curvatureK2Od: '',
            curvatureK2OdInfo: '',
            curvatureK2Os: '',
            curvatureK2OsInfo: '',
            wtwOd: '',
            wtwOs: '',
            iopOd: '',
            iopOs: '',
            fundusExaminationOd: '',
            fundusExaminationInfoOd: '',
            fundusExaminationOs: '',
            fundusExaminationInfoOs: '',
            mydriaticOptBallOd: '',
            mydriaticOptBallOs: '',
            mydriaticOptPostOd: '',
            mydriaticOptPostOs: '',
            mydriaticOptAxesOd: '',
            mydriaticOptAxesOs: '',
            mydriaticOptCvaOd: '',
            mydriaticOptCvaOs: '',
            mainOptBallOd: '',
            mainOptBallOs: '',
            mainOptPostOd: '',
            mainOptPostOs: '',
            mainOptAxesOd: '',
            mainOptAxesOs: '',
            mainOptCvaOd: '',
            mainOptCvaOs: '',
            eyePosition: '',
            eyePositionInfo: '',
            pencilGrasps: '',
            nearPoint: '',
            colorVision: '',
            masterEye: '',
            eyeDisease: '',
            refractiveStatus: '',
            myopiaWarning: '',
            checkDoctor: '',
            checkDoctorName: '',
            mainDoctor: '',
            mainDoctorName: '',
            memo: '',
            isMyopia: '',
            myopiaOd: '',
            myopiaOs: '',
            wechatPush: '',
            wechatPushDate: '',
            bmi: '',
            bmiResult: '',
            hostname: '',
            ipAddr: '',
            nextCheckDate: '',
            recheckType: ''
          },

        },
        userOptions: [],
        refractiveOption: [],
        fundusExaminationOption: [],
        schoolTypeOption: [],
        schoolOption: [],
        gradeOption: [],
        classOptions: [],
        schoolVisible: false,
        gradeVisible: false,
        classVisible: false,
        personVisible: false
      }
    },
    computed: {
      ...mapGetters(['bizData','userInfo'])
    },
    components: {
      SearchPerson
    },
    methods: {
      // 获取当前时间
      async getNowDateStr(){
        let nowDateStr = ''
        await getNowTime().then(response => {
          nowDateStr = response.data.data
        }).catch(() => {
          this.fullscreenLoading = false
        })
        return nowDateStr
      },
      // 获取学校列表
      getSchoolList(){
        getSchoolList().then(response => {
          if(response.data.code == '0'){
          	this.schoolOption = response.data.data
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
      init(formType,id,customerId) {
        this.$refs.dataForm.resetFields() // 重置表单并清除校验信息
        this.formType = formType
        this.getSchoolList()
        for (let key in this.dataForm) {
          this.dataForm[key] = ''
        }
        this.dataForm.optometry = {}
        for (let key in this.personInfo) {
          if (key == 'personExtProp') {
            this.personInfo.personExtProp = {
              fatherMyopia: '',
              motherMyopia: '',
              habitHand: ''
            }
          } else {
            this.personInfo[key] = ''
          }
        }
        this.dataForm.id = id || ''
        this.getDoctorList()
        this.getUsersList()
        this.getNationalList()
        this.visible = true
        this.$nextTick(() => {
          remote('fundus').then(response => {
            this.fundusExaminationOption = response.data.data
          })
          remote('refractive_status1').then(response => {
            this.refractiveOption = response.data.data
          })
          remote('school_type').then(response => {
            this.schoolTypeOption = response.data.data
          })
          this.$set(this.dataForm.optometry,'checkDoctor',this.userInfo.id)
          this.getNowDateStr().then(response => {
						let resultStr = response.substring(0,10)
            this.$set(this.dataForm.optometry,'checkDate',resultStr)
            if(customerId){
              getPersonObj(customerId).then(response1 => {
                if(response1.data.code == '0'){
                	this.personInfo = response1.data.data
                	this.dataForm.personInfo = response1.data.data
                	this.checkHistory(this.personInfo.cardNum,this.personInfo.uniqueCode,resultStr)
									if (this.personInfo.pvmStudent) {
									  this.schoolChange(this.personInfo.pvmStudent.schoolId,this.personInfo.pvmStudent.gradeId,this.personInfo.pvmStudent.classId)
									  this.dataForm.optometry.schoolId = this.personInfo.pvmStudent.schoolId
									  this.dataForm.optometry.schoolName = this.personInfo.pvmStudent.schoolName
									  this.dataForm.optometry.schoolType = this.personInfo.pvmStudent.schoolType
									  this.getClassOption(this.personInfo.pvmStudent.gradeId,this.personInfo.pvmStudent.classId)
									  this.dataForm.optometry.gradeId = this.personInfo.pvmStudent.gradeId
									  this.dataForm.optometry.gradeName = this.personInfo.pvmStudent.gradeName
									  this.dataForm.optometry.classId = this.personInfo.pvmStudent.classId
									  this.dataForm.optometry.className = this.personInfo.pvmStudent.className
									}
                }else{
                	this.$message.error(response1.data.msg)
                }
              })
            }else{
              if (this.dataForm.id) {
                this.fullscreenLoading = true
                getPvmArcOptometryObj(this.dataForm.id).then(response => {
                  if(response.data.code == '0'){
                  	this.fullscreenLoading = false
                  	if(response.data.data.optometry){
                  	  this.dataForm.optometry = response.data.data.optometry
                  	  this.personInfo = response.data.data.personInfo
                  	  this.dataForm.personInfo = response.data.data.personInfo
                  	  let gradeId = this.dataForm.optometry.gradeId
                  	  let classId = this.dataForm.optometry.classId
                  	  this.schoolChange(this.dataForm.optometry.schoolId,this.dataForm.optometry.gradeId,this.dataForm.optometry.classId)
                  	  this.getClassOption(this.dataForm.optometry.gradeId,this.dataForm.optometry.classId)
                  	}
                  	getPersonObj(this.dataForm.optometry.personId).then(response1 => {
                      if(response1.data.code == '0'){
                      	this.personInfo = response1.data.data
                      	this.dataForm.personInfo = response1.data.data
                      }else{
                      	this.$message.error(response1.data.msg)
                      }
                  	})
                  }else{
                  	this.$message.error(response.data.msg)
                  }

                }).catch(() => {
                  this.fullscreenLoading = false
                })
              }
            }

          })
        })
      },
      checkChangeHandle(val){
        this.checkHistory(this.personInfo.cardNum,this.personInfo.uniqueCode,val)
      },
      // 进入页面&修改日期时查询当天的检查记录
      checkHistory(cardNum,uniqueCode,checkDate){
        let params = {
          cardNum: cardNum,
          uniqueCode: uniqueCode,
          checkDate: checkDate
        }
        let that = this
        getCheckRecord(params).then(response => {
          if(response.data.code == '0'){
          	let resultData = response.data.data
          	if(resultData){
          	  that.$set(that.dataForm.optometry,'height',resultData.height)
          	  that.$set(that.dataForm.optometry,'weight',resultData.weight)

          	  that.$set(that.dataForm.optometry,'nakedOd',resultData.nakedOd) // 裸眼远视力
          	  that.$set(that.dataForm.optometry,'nakedOs',resultData.nakedOs) // 裸眼远视力
          	  that.$set(that.dataForm.optometry,'oldBallGlassOd',resultData.djOd01)
          	  that.$set(that.dataForm.optometry,'oldBallGlassOs',resultData.djOs01)
          	  that.$set(that.dataForm.optometry,'oldPostGlassOd',resultData.djOd02)
          	  that.$set(that.dataForm.optometry,'oldPostGlassOs',resultData.djOs02)
          	  that.$set(that.dataForm.optometry,'oldAxesOd',resultData.djOd03)
          	  that.$set(that.dataForm.optometry,'oldAxesOs',resultData.djOs03)


          	  that.$set(that.dataForm.optometry,'distantOd',resultData.distantOd)
          	  that.$set(that.dataForm.optometry,'distantOs',resultData.distantOs)

          	  that.$set(that.dataForm.optometry,'ballGlassOd',resultData.dtOd01)
          	  that.$set(that.dataForm.optometry,'ballGlassOs',resultData.dtOs01)
          	  that.$set(that.dataForm.optometry,'postGlassOd',resultData.dtOd02)
          	  that.$set(that.dataForm.optometry,'postGlassOs',resultData.dtOs02)
          	  that.$set(that.dataForm.optometry,'axesOd',resultData.dtOd03)
          	  that.$set(that.dataForm.optometry,'axesOs',resultData.dtOs03)

          	  that.$set(that.dataForm.optometry,'frontOd',resultData.frontOd)
          	  that.$set(that.dataForm.optometry,'frontOs',resultData.frontOs)
          	  that.$set(that.dataForm.optometry,'frontOdText',resultData.frontOdText)
          	  that.$set(that.dataForm.optometry,'frontOsText',resultData.frontOsText)

          	  that.$set(that.dataForm.optometry,'axialLengthOd',resultData.alOd)
          	  that.$set(that.dataForm.optometry,'axialLengthOs',resultData.alOs)

          	  that.$set(that.dataForm.optometry,'depthOd',resultData.depthOd)
          	  that.$set(that.dataForm.optometry,'depthOs',resultData.depthOs)

          	  that.$set(that.dataForm.optometry,'adOd',resultData.adOd)
          	  that.$set(that.dataForm.optometry,'adOs',resultData.adOs)

          	  that.$set(that.dataForm.optometry,'curvatureK1Od',resultData.k1Od01)
          	  that.$set(that.dataForm.optometry,'curvatureK1Os',resultData.k1Os01)
          	  that.$set(that.dataForm.optometry,'curvatureK1OdInfo',resultData.k1Od02)
          	  that.$set(that.dataForm.optometry,'curvatureK1OsInfo',resultData.k1Os02)

          	  that.$set(that.dataForm.optometry,'curvatureK2Od',resultData.k2Od01)
          	  that.$set(that.dataForm.optometry,'curvatureK2Os',resultData.k2Os01)
          	  that.$set(that.dataForm.optometry,'curvatureK2OdInfo',resultData.k2Od02)
          	  that.$set(that.dataForm.optometry,'curvatureK2OsInfo',resultData.k2Os02)

          	  that.$set(that.dataForm.optometry,'wtwOd',resultData.wtwOd)
          	  that.$set(that.dataForm.optometry,'wtwOs',resultData.wtwOs)
          	  that.$set(that.dataForm.optometry,'iopOd',resultData.yyOd)
          	  that.$set(that.dataForm.optometry,'iopOs',resultData.yyOs)

          	  that.$set(that.dataForm.optometry,'mydriaticOptBallOd',resultData.stOd01)
          	  that.$set(that.dataForm.optometry,'mydriaticOptPostOd',resultData.stOd02)
          	  that.$set(that.dataForm.optometry,'mydriaticOptAxesOd',resultData.stOd03)
          	  that.$set(that.dataForm.optometry,'mydriaticOptCvaOd',resultData.stOd04)
          	  that.$set(that.dataForm.optometry,'mydriaticOptBallOs',resultData.stOs01)
          	  that.$set(that.dataForm.optometry,'mydriaticOptPostOs',resultData.stOs02)
          	  that.$set(that.dataForm.optometry,'mydriaticOptAxesOs',resultData.stOs03)
          	  that.$set(that.dataForm.optometry,'mydriaticOptCvaOs',resultData.stOs04)

          	  that.$set(that.dataForm.optometry,'mainOptBallOd',resultData.mainOd01)
          	  that.$set(that.dataForm.optometry,'mainOptPostOd',resultData.mainOd02)
          	  that.$set(that.dataForm.optometry,'mainOptAxesOd',resultData.mainOd03)
          	  that.$set(that.dataForm.optometry,'mainOptCvaOd',resultData.mainOd04)
          	  that.$set(that.dataForm.optometry,'mainOptBallOs',resultData.mainOs01)
          	  that.$set(that.dataForm.optometry,'mainOptPostOs',resultData.mainOs02)
          	  that.$set(that.dataForm.optometry,'mainOptAxesOs',resultData.mainOs03)
          	  that.$set(that.dataForm.optometry,'mainOptCvaOs',resultData.mainOs04)


          	  that.$set(that.dataForm.optometry,'eyePosition',resultData.yw)
          	  that.$set(that.dataForm.optometry,'eyePositionCrypticInfo',resultData.ywText01)
          	  that.$set(that.dataForm.optometry,'eyePositionInfo',resultData.ywText02)

          	  that.$set(that.dataForm.optometry,'pencilGrasps',resultData.correctHold)
          	  that.$set(that.dataForm.optometry,'nearPoint',resultData.jhjd)
          	  that.$set(that.dataForm.optometry,'colorVision',resultData.color)
          	  that.$set(that.dataForm.optometry,'masterEye',resultData.ysy)


          	  that.$set(that.dataForm.optometry,'refractiveStatus',resultData.refractiveStatus)
          	  that.$set(that.dataForm.optometry,'earlyWarning',resultData.earlyWarning)
          	  that.$set(that.dataForm.optometry,'eyeDisease',resultData.eyeDisease)

          	  // 主检医生 docDataId
          	  that.$set(that.dataForm.optometry,'mainDoctor',resultData.docDataId)
          	}
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
			readCard(cardNumber){
        if(cardNumber){
          fetchPersonInfoByCode(cardNumber).then(response => {
            if(response.data.code == '0'){
            	this.personInfo = response.data.data
            	this.personInfo.cardNum = response.data.data.cardNum || cardNumber
            	this.personInfo.personExtProp = response.data.data.personExtProp || {}
            	let schoolId = response.data.data.pvmStudent.schoolId
            	let gradeId = response.data.data.pvmStudent.gradeId
            	let classId = response.data.data.pvmStudent.classId
            	this.dataForm.optometry.schoolId = response.data.data.pvmStudent.schoolId
            	this.schoolChange(schoolId,gradeId,classId)
            	this.getClassOption(gradeId,classId)
            }else{
            	this.$message.error(response.data.msg)
            }
          })
        }else{
          this.$message.warning('请填写标识码')
        }
			},
      getPersonInfo(cardNum,) {

      },
      openDialog(type) {
        if (type == 'school') {
          let form = {
            province: this.dataForm.optometry.province,
            city: this.dataForm.optometry.city,
            area: this.dataForm.optometry.area,
            schoolType: this.dataForm.optometry.schoolType
          }
          this.schoolVisible = true
          this.$nextTick(() => {
            this.$refs.schoolDialog.init(JSON.stringify(form))
          })
        } else if (type == 'grade') {
          if (this.dataForm.optometry.schoolId) {
            let form = {
              schoolType: this.dataForm.optometry.schoolType
            }
            this.gradeVisible = true
            this.$nextTick(() => {
              this.$refs.gradeDialog.init(JSON.stringify(form))
            })
          } else {
            this.$message.warning('请先选择学校')
          }
        } else if (type == 'class') {
          if (this.dataForm.optometry.gradeId) {
            let form = {
              schoolId: this.dataForm.optometry.schoolId,
              schoolName: this.dataForm.optometry.schoolName,
              gradeId: this.dataForm.optometry.gradeId,
              gradeName: this.dataForm.optometry.gradeName
            }
            this.classVisible = true
            this.$nextTick(() => {
              this.$refs.classDialog.init(JSON.stringify(form))
            })
          } else {
            this.$message.warning('请先选择学校年级')
          }
        } else if (type == 'person') {
          this.personVisible = true
          this.$nextTick(() => {
            this.$refs.personDialog.init()
          })
        }

      },
      // 表单提交
      dataFormSubmit() {
        this.dataForm.personInfo = this.personInfo
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            if (this.dataForm.id) {
              putPvmArcOptometryObj(this.dataForm).then(response => {
                if(response.data.code == '0'){
                	this.$message.success('修改成功')
                	this.visible = false
                	this.$emit('refreshDataList')
                }else{
                	this.$message.error(response.data.msg)
                }
              })
            } else {
              addPvmArcOptometryObj(this.dataForm).then(response => {
                if(response.data.code == '0'){
                	this.$message.success('添加成功')
                	this.visible = false
                	this.$emit('refreshDataList')
                }else{
                	this.$message.error(response.data.msg)
                }
              })
            }
          }
        })
      },
      getSchoolData(val) {
        this.$set(this.dataForm.optometry, 'schoolId', val.id)
        this.$set(this.dataForm.optometry, 'schoolName', val.schoolName)
        this.$set(this.dataForm.optometry, 'schoolType', val.schoolType)
      },
      getGradeData(val) {
        this.$set(this.dataForm.optometry, 'gradeId', val.id)
        this.$set(this.dataForm.optometry, 'gradeName', val.gradeName)
      },
      getClassData(val) {
        this.$set(this.dataForm.optometry, 'classId', val.id)
        this.$set(this.dataForm.optometry, 'className', val.className)
      },
      getPersonData(val) {
        getPersonObj(val.id).then(response => {
          if(response.data.code == '0'){
          	let resultData = response.data.data
          	this.personInfo = response.data.data
          	this.personInfo.cardNum = response.data.data.cardNum || val.cardNum
          	for(let key in this.dataForm.optometry){
          	  if(key != 'checkDoctor' && key != 'mainDoctor' && key != 'checkDate'){
          	    this.dataForm.optometry[key] = ''
          	  }
          	}
          	let obj = {}
          	obj = this.userOptions.find(item => {
          	  return item.id == this.dataForm.optometry.checkDoctor
          	})
          	this.$set(this.dataForm.optometry,'checkDoctorName',obj.realName)
          	if (resultData.pvmStudent) {
              this.schoolChange(resultData.pvmStudent.schoolId,resultData.pvmStudent.gradeId,resultData.pvmStudent.classId)
          	  this.dataForm.optometry.schoolId = resultData.pvmStudent.schoolId
          	  this.dataForm.optometry.schoolName = resultData.pvmStudent.schoolName
          	  this.dataForm.optometry.schoolType = resultData.pvmStudent.schoolType
              this.getClassOption(resultData.pvmStudent.gradeId,resultData.pvmStudent.classId)
          	  this.dataForm.optometry.gradeId = resultData.pvmStudent.gradeId
          	  this.dataForm.optometry.gradeName = resultData.pvmStudent.gradeName
          	  this.dataForm.optometry.classId = resultData.pvmStudent.classId
          	  this.dataForm.optometry.className = resultData.pvmStudent.className
          	}
          }else{
          	this.$message.error(response.data.msg)
          }

        })
      },
      //  根据key值获取url
      getPathByKey(key) {
        let obj = {}
        obj = this.bizData.personTypeData.find(item => {
          if (item.key == key) {
            return item
          }
        })
        if (obj) {
          return obj.value
        }
      },
      //  获取用户列表(销售人员)
      getUsersList() { // key = '1'
        let path = this.getPathByKey('1')
        getUserListByMenu({
          menuUrl: path
        }).then(response => {
          if(response.data.code == '0'){
          	this.userOptions = response.data.data
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
      // 获取主检医生列表
      getDoctorList(){
        getUserListByJobType(7).then(response => {
          if(response.data.code == '0'){
          	this.doctorOptions = response.data.data
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
      handleClick(tab, event) {
        if (tab.name == "三维检查") {} else if (tab.name == "特殊检查") {
          this.twoVisible = true
          this.$nextTick(() => {
            this.$refs.twoTab.init(this.dataForm.id)
          })
        } else if (tab.name == "五大干预") {
          // this.threeVisible = true
          // this.$nextTick(() => {
          //   this.$refs.threeTab.init(this.dataForm.id,this.dataForm.customerCard)
          // })
        } else if (tab.name == "影像采集") {
          // this.fourVisible = true
          // this.$nextTick(() => {
          //   this.$refs.fourTab.init(this.dataForm.id,this.dataForm.customerCard)
          // })
        }
      },
      changeDoctor(val){
        let obj = {}
        obj = this.userOptions.find(item => {
          return item.id == val
        })
        this.$set(this.dataForm.optometry,'checkDoctor',val)
        this.$set(this.dataForm.optometry,'checkDoctorName',obj.realName)

        this.dataForm = {...this.dataForm}
      },
      // 获取主检医生名称
      changeMainDoctor(val){
        let obj = {}
        obj = this.doctorOptions.find(item => {
          return item.id == val
        })
        this.$set(this.dataForm.optometry,'mainDoctor',val)
        this.$set(this.dataForm.optometry,'mainDoctorName',obj.realName)

        this.dataForm = {...this.dataForm}
      },
      // 获取民族列表
      getNationalList(){
        fetchNationalList({ current: 1, size: 100 }).then(response => {
          if(response.data.code == '0'){
          	this.nationalList = response.data.data.records
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
      // 打印报告单
      print_opt(id){
        let routeUrl = this.$router.resolve({
          path: "/print",
          query: {id: id}
        });
        window.open(routeUrl.href, '_blank');
      },
      // tab键切换输入框
      tabKayChangeHandle(val){
        setTimeout(() => {
          this.$refs[val].focus()
        },0)
      },
      //
      schoolTypeChange(){
        this.schoolOption = [],
        this.gradeOption = [],
        this.classOptions = [],
        this.$set(this.dataForm.optometry, 'schoolId', '')
        this.$set(this.dataForm.optometry, 'gradeId', '')
        this.$set(this.dataForm.optometry, 'classId', '')
        if (this.dataForm.optometry.schoolType) {
          getSchoolListBySchoolType(this.dataForm.optometry.schoolType).then(response => {
            if(response.data.code == '0'){
            	this.schoolOption = response.data.data
            }else{
            	this.$message.error(response.data.msg)
            }
          })
        } else {
          getSchoolList().then(response => {
            if(response.data.code == '0'){
            	this.schoolOption = response.data.data
            }else{
            	this.$message.error(response.data.msg)
            }
          })
        }
      },
      schoolChange(schoolId,gradeId,classId) {
        this.gradeOption = [],
        this.classOptions = [],
        this.$set(this.dataForm.optometry, 'gradeId', gradeId)
        this.$set(this.dataForm.optometry, 'classId', classId)
        if(schoolId) {
          getGradeBySchoolId(schoolId).then(response => {
            if(response.data.code == '0'){
            	this.gradeOption = response.data.data
            }else{
            	this.$message.error(response.data.msg)
            }
          })
        }
      },
      // 获取班级列表
      getClassOption(gradeId,classId) {
        this.classOptions = []
        this.$set(this.dataForm.optometry, 'classId', classId)
        getClassOptions(this.dataForm.optometry.schoolId, gradeId).then(response => {
          if(response.data.code == '0'){
          	this.classOptions = response.data.data
          }else{
          	this.$message.error(response.data.msg)
          }
        })
      },
      // 散瞳验光(复制动态验光)
      breakCheckHandle(){
        this.$set(this.dataForm.optometry,'mydriaticOptBallOd',this.dataForm.optometry.ballGlassOd)
        this.$set(this.dataForm.optometry,'mydriaticOptPostOd',this.dataForm.optometry.postGlassOd)
        this.$set(this.dataForm.optometry,'mydriaticOptAxesOd',this.dataForm.optometry.axesOd)
        this.$set(this.dataForm.optometry,'mydriaticOptBallOs',this.dataForm.optometry.ballGlassOs)
        this.$set(this.dataForm.optometry,'mydriaticOptPostOs',this.dataForm.optometry.postGlassOs)
        this.$set(this.dataForm.optometry,'mydriaticOptAxesOs',this.dataForm.optometry.axesOs)
      },
      // 主觉验光(复制散瞳验光)
      mainCheckHandle(){
        this.$set(this.dataForm.optometry,'mainOptBallOd',this.dataForm.optometry.mydriaticOptBallOd)
        this.$set(this.dataForm.optometry,'mainOptPostOd',this.dataForm.optometry.mydriaticOptPostOd)
        this.$set(this.dataForm.optometry,'mainOptAxesOd',this.dataForm.optometry.mydriaticOptAxesOd)
        this.$set(this.dataForm.optometry,'mainOptBallOs',this.dataForm.optometry.mydriaticOptBallOs)
        this.$set(this.dataForm.optometry,'mainOptPostOs',this.dataForm.optometry.mydriaticOptPostOs)
        this.$set(this.dataForm.optometry,'mainOptAxesOs',this.dataForm.optometry.mydriaticOptAxesOs)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .bg-row {
    // background-color: #cadee8;
    padding-left: 15px;
    padding-top: 5px;
  }

  .miui-table {
    width: 100%;
    margin: 10px 0;
    border-collapse: collapse;
    // background-color: #b1e2ec3b;

    tr th {
      background-color: #f4f5f7;
    }

    tr th,
    tr td {
      padding: 5px 8px;
      border: solid 1px #8d8d8d;
      text-align: center;
    }

    .miui-table-header td {
      background-color: #7898a8;
      color: #fff;
      text-align: center;
    }

    .miui-table-tbody {
      background-color: #cadee8;
    }
  }
</style>
